/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package combomodel.contabancaria;

import eloma.classe.contabancaria.ContaBancaria;
import java.util.List;
import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;

/**
 *
 * @author icaro.klinger
 */
public class ComboBoxContaBancariaModel extends AbstractListModel implements ComboBoxModel {

    private List<ContaBancaria> listaContaBancaria;
    private ContaBancaria selection;

    public ComboBoxContaBancariaModel(List<ContaBancaria> listaContaBancaria) {
        this.listaContaBancaria = listaContaBancaria;
    }

    @Override
    public int getSize() {
        return listaContaBancaria.size();
    }

    @Override
    public Object getElementAt(int index) {
        return listaContaBancaria.get(index);
    }

    @Override
    public void setSelectedItem(Object anItem) {
        selection = (ContaBancaria) anItem;
    }

    @Override
    public Object getSelectedItem() {
        return selection;
    }

}
